package com.zhengsr.drawbroad.utils;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

/**
 * Created by zhengshaorui on 2018/7/24.
 */

public class BgUtils {
    public static Bitmap drawGrayLineBg(int width, int height) {
        Bitmap localBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(localBitmap);
        canvas.drawColor(Color.parseColor("#333b3e"));
        Paint localPaint = new Paint();
        localPaint.setAntiAlias(true);
        localPaint.setStyle(Paint.Style.STROKE);
        localPaint.setStrokeWidth(2.0F);
        localPaint.setColor(Color.BLACK);
        localPaint.setAlpha(50);
        //缩略图20
        int space = 80;
        if(height<600){
            space = 10;
        }
        for (int i = 0; i < width / space; i++) {
            canvas.drawLine(i * space, 0, i * space, height, localPaint);
        }
        for (int j = 0; j < height / space + 1; j++) {
            canvas.drawLine(0, j * space, width, j * space, localPaint);
        }
        return localBitmap;
    }
}
